The Blog of JebLin

The Blog of JebLin

The winter is comming

use github step by step

use github step by step

The following operation will help you manage your code with github.

1.download github for windows https://git-for-windows.github.io/
2.install
3.create a new floader eg.E:\code\gitProject\SwordTreasure
4.choose the ‘GIT BUSH HERE’ by right-clicking
5.print ‘git init’ to init the floder. (it will generate a file which record the configuration about the github name ‘.git’)

1
git init

6.create ssh key:

1
ssh-keygen -t rsa -C "Sword52888@163.com"

7.open the gihub –> Account Setting –> SSH and GPG keys –> NEW SSH Key –> paste the key and fill in the title with anything.

8.verify that the connection is successful with github.

1
ssh -T git@github.com

if output is ‘continue’ ,and then print ‘yes’ ,and if you get the result of ‘You have successfully authenticated, but GitHub does not provide shell access ‘. it proves that you have successfully conntect the github.

9.pull the project from git hub by coding:

1
git clone "https://github.com/JebLin/JebLin.github.io.git"

Tips : you can find the repository url in the following place.

10.enter the floder ‘E:\code\gitProject\SwordTreasure’ and edit the file ‘README.md’.

11.check the changes of the files ,if the color of the file is red .it indicate the file status is ‘unsigned’.

1
git status

12.sign the Modified file status.if the color of the file turn to green.it indicate the file status is ‘ready’.

1
git add .

13.commit the modified file to github with the comment by ‘-m’.

1
git commit -m 'i have modified the file because ...'

14.push the file to github .

1
2
git push -u origin master
(git push)

you can check the changes by login the github ,just flush the page .And you can see the difference.

15.pull the code to your computer.(like the update operation of SVN).

1
git pull

16.if you have deleted file from working directory and not commited the changes yet. like SVN revert.

1
git checkout -f

17.remove directory from git and local.

1
2
3
git rm -r one-of-the-directories
git commit -m "Remove some directory"
git push -u origin master


about the error

1.if the console says ‘Who are you’ ,you should config your github.

1
2
git config --global user.name "JebLin"
git config --global user.email "Sword52888@163.com"

2.if you can not generate the key ,then create the floder by the error tip .
eg. ‘Saving key “%HOMEDRIVE%%HOMEPATH%/.ssh/id_rsa” failed: No such file or directory’
then ‘GIT GUI HERE’ –> ‘HELP’ –> ‘SHOW SSH KEY’ –> create folder by tip. like